import Vue from 'vue'
import Router from 'vue-router'

//连续两次切换同一个路由出错的设置
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:{name:'Home'}   //主页路由
    },
    {
      path:'/home',
      name:'Home',
      component:()=>import('@/views/home/Index')  //主页路由
    },
    {
      path:'/login',
      name:'Login',
      component:()=>import('@/views/login/Index') //登录路由
    },
    {
      path:'/register',
      name:'Register',
      component:()=>import('@/views/register/Index') //注册路由
    }
  ]
})
